# 数字 n 代表生成括号的对数，请你设计一个函数，用于能够生成所有可能的并且 有效的 括号组合。
# 输入：n = 3
# 输出：[
#        "((()))",
#        "(()())",
#        "(())()",
#        "()(())",
#        "()()()"
#      ]
#
# 链接：https://leetcode-cn.com/problems/generate-parentheses
# 未完待续
# 整理了一下大概是个递归
# 然而分组还没试出来...
class Solution:
    full = "()"
    left = "("
    right = ")"

    # inner 生成嵌套型((()))括号,input层数
    def matryoshka(self, i):
        result = self.left * i + self.right * i
        print(result)
        return result

    # inner 生成列队型的括号()(),input次数
    def queue(self, j):
        result = self.full * j
        print(result)
        return result

    # 主函数
    def generateParenthesis(self, n: int):
        result = []
        aaa = self.matryoshka(n)
        bbb = self.queue(n)
        result.append(aaa)
        result.append(bbb)
        print(result)


        # return result


test = Solution()
result = test.generateParenthesis(3)

